{% extends "admin/base_site.html" %}
{% load i18n admin_modify adminmedia %}

{% block extrahead %}{{ block.super }}
<script type="text/javascript">
  $(document).ready(function(){

    $('#id_date').datepicker();

    $(".filetree").treeview({
        persist: "location",
        collapsed: true,
        unique: true
    });

  });
</script>

<link rel="stylesheet" href="/static/jquery-ui-themes/default/ui.datepicker.css" type="text/css">
<script src="/static/jquery-ui/ui.datepicker.js" type="text/javascript"></script>
<link rel="stylesheet" href="/static/jquery-plugins/treeview/jquery.treeview.css" />
<script src="/static/jquery-plugins/treeview/jquery.treeview.js" type="text/javascript"></script>
{% endblock %}

{% block content %}
<h1>Eingangs Rechnung Verwalten</h1>
<fieldset class="forms"><legend>upload</legend>
<form enctype="multipart/form-data" method="post" action=".">
<ul id="input_fields">
    {% for field in form %}
        <li title="{{ field.help_text }}" class="{{ field.html_name }}">
        <label for="{{ field.auto_id }}">{{ field.label }}:</label>
        {{ field }}
        <span class="field_help_text">{{ field.help_text }}</span>
        {% if field.errors %}<li class="field_errors">{{ field.errors }}</li>{% endif %}
    </li>
    {% endfor %}
</ul>
<input type="submit" name="save" value="speichern" />
</form>
</fieldset>

<fieldset><legend>EingangsRechnungen</legend>
<ul class="filetree">
{% for dir, files in filelist.items %}
    <li><span class="folder">{{ dir }}</span>
        <ul>
        {% for file in files %}
           <li><span class="file">
            <a href="{{ file.specify_url }}">{{ file.name }}</a>
            <a href="{{ file.download_url }}">download</a>
           </span></li>
        {% endfor %}
        </ul>
    </li>
{% endfor %}
</ul>
</fieldset>
{% endblock %}